//
//  ProcedureCallRequest.m
//  Nurse
//
//  Created by 夏 申频 on 14-1-5.
//  Copyright (c) 2014年 Honeywell. All rights reserved.
//

#import "ProcedureCallRequest.h"
#import "DataEngine.h"
@implementation ProcedureCallRequest

-(id)parsePRODUCEResponse:(id)response{
    if ([response isKindOfClass:[NSDictionary class]]) {
        NSNumber* success = [response valueForKey:@"success"];
        if ([success boolValue]) {
            id jsonResult =  [response valueForKey:@"result"];
            if ([jsonResult isKindOfClass:[NSArray class]]) {
                return jsonResult;
            }else
                return @[jsonResult];
        }else{
            NSString* msg = [NSString stringWithFormat:@"错误信息:%@",[response valueForKey:@"msg"]];
            return [DataEngine makeErrorForMsg:msg];
        }
    }else if([response isKindOfClass:[NSArray class]]){
        return response;
    }else if([response isKindOfClass:[NSString class]]){
        return response;
    }else
        return [DataEngine makeErrorForMsg:@"未知的返回类型"];;
}

@end
